{php include aide_template('common/header');}
<div class="page-group">
    <div class="page page-current" id="page-coupon-get">
		<div class="content native-scroll app">
			<div class="app-coupon">
				<div class="promote-card">
					<div class="name clearfix">
						<span class="js-name"> {$coupon['name']} </span>
						<!--<a href="" class="promote-share">分享</a>-->
					</div>
					<div class="text-center promote-value">
						￥ <span class="js-value"> {if $coupon['is_random'] == 2} {$coupon['value']} ~ {$coupon['value_to']} {else} {$coupon['value']} {/if} </span>
					</div>
					<div class="text-center promote-limit js-is-at-least">
						{if !empty($coupon['at_least']) && $coupon['at_least'] != 0.00}
						订单满 <span class="js-at-least">  {$coupon['at_least']} </span>元 (不含运费)
						{else}
							不限制
						{/if}
					</div>
					<div class="text-center promote-time">
						有效日期：<span class="js-start-time"> {php echo date('Y-m-d H:i:s', $coupon['start_time']);} </span> - <span class="js-end-time"> {php echo date('Y-m-d H:i:s', $coupon['end_time']);} </span>
					</div>
					<div class="dot"></div>
				</div>
				<div class="promote-desc">
					<div class="promote-desc-title">使用说明</div>
					<div class="desc-detail js-description">
						{$coupon['description']}
					</div>
				</div>
				<div class="weui_btn_area">
		        	<div class="weui_btn weui_btn_primary" href="javascript:" id="getcoupon">领取优惠券</div>
		    	</div>
			</div>
		</div>
	</div>
</div>
<script>
	$(function() {
		'use strict';
		//编辑地址页
		$(document).on("pageInit", "#page-coupon-get", function(e, id, page) {
			var $content = $(page).find('.content');
			$content.on('click','#getcoupon',function () {
				$.post("{php echo app_url('member/coupon/post',array('id'=>$id))}",{},function(d){
					if(d.status == 1){
						$.alert('优惠券领取成功', function () {
					        location.href = "{php echo app_url('member/coupon')}";
					    });
					}else{
						$.toast(d.result);
					}
				},"json");
		    });
		});
		$.init();
	});
</script>
{php include aide_template('common/footer');}
